<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="CONTENT_LOCALES_COLLECTION_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="HTML_TEXT_FIELD_MAX_LENGTH" />

<atleap:javascript formName="actionPageForm" staticJavascript="false" dynamicJavascript="true" method="validateForm" cdata="false" />

<atleap:isUserInRole roles="core-actionPage-update" var="canUpdate" />

<atleap:content identifier="information" ignore="true" uri="/core/actionPage/callCreate" />
<atleap:messages property="actionPageAlreadyExists" />
<atleap:messages property="actionPageIncorrectUri" />
<br />
<atleap:form action="core/actionPage/update" method="POST">
	<atleap:messages property="updateFailed" />
    <table cellpadding="0" cellspacing="0" border="0" class="modificationTable">
		<tr>
			<td colspan="2" align="center">
				<atleap:label property="title" key="core.page.form.title" colon="false" helpTip="true" />
			</td>
		</tr>
		<atleap:iterator items="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}" var="contentLocale">
			<tr>
				<th>
					<div class="languageField">
						<atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
						<c:if test="${empty languageTitle}">
							<c:set var="languageTitle" value="${contentLocale.identifier}" />
						</c:if>
						*&nbsp;<atleap:message key="core.page.form.language" />:&nbsp;${languageTitle}
					</div>
				</th>
				<td>
					<html:text property="title(${contentLocale.identifier})" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}"
 styleClass="text" />
				</td>
			</tr>
		</atleap:iterator>
		<tr>
			<td colspan="2" align="center">
				<atleap:label property="description" key="core.page.form.description" colon="false" helpTip="true" />
			</td>
		</tr>
		<atleap:iterator items="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}" var="contentLocale">
			<tr>
				<th>
					<div class="languageField">
						<atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
						<c:if test="${empty languageTitle}">
							<c:set var="languageTitle" value="${contentLocale.identifier}" />
						</c:if>
						<atleap:message key="core.page.form.language" />:&nbsp;${languageTitle}
					</div>
				</th>
				<td>
					<html:text property="description(${contentLocale.identifier})" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}"
 styleClass="text" />
				</td>
			</tr>
		</atleap:iterator>
		<tr>
			<td colspan="2" align="center">
				<atleap:label property="keywords" key="core.page.form.keywords" colon="false" helpTip="true" />
			</td>
		</tr>
		<atleap:iterator items="${sessionScope[pageScope.CONTENT_LOCALES_COLLECTION_KEY]}" var="contentLocale">
			<tr>
				<th>
					<div class="languageField">
						<atleap:fieldValue valueMap="${contentLocale.title}" var="languageTitle" />
						<c:if test="${empty languageTitle}">
							<c:set var="languageTitle" value="${contentLocale.identifier}" />
						</c:if>
						<atleap:message key="core.page.form.language" />:&nbsp;${languageTitle}
					</div>
				</th>
				<td>
					<html:text property="keywords(${contentLocale.identifier})" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}"
 styleClass="text" />
				</td>
			</tr>
		</atleap:iterator>
        <tr>
            <td colspan="2"></td>
        </tr>
        <tr>
            <th>
                <atleap:label property="uri" key="core.page.form.uri" colon="false" helpTip="true" />
            </th>
            <td nowrap="nowrap">
                <c:choose>
                    <c:when test="${canUpdate}">
                        <html:text property="uri" styleClass="text" maxlength="${pageScope.HTML_TEXT_FIELD_MAX_LENGTH}" styleId="uriInput" />
                        <input type="submit" class="button" onclick="browseInPopup('<atleap:rewriteUrl action="/core/actionPage/listActions?uri=${actionPageForm.uri}"  />', 'uriInput'); return false;" value="<atleap:message key="core.commons.buttons.browse" />" />
                    </c:when>
                    <c:otherwise>
                        <html:hidden property="uri" />
                        &nbsp;<c:out value="${actionPageForm.uri}" escapeXml="true" />
                    </c:otherwise>
                </c:choose>
            </td>
        </tr>
        <c:choose>
            <c:when test="${canUpdate}">
                <tr>
                    <td colspan="2" align="right" nowrap="nowrap">
                        <atleap:label styleClass="labelCheckbox"  property="linkable" key="core.actionPage.form.linkable" colon="false" helpTip="true" />
                        <html:checkbox styleClass="checkbox" property="active" />
                    </td>
                </tr>
            </c:when>
            <c:otherwise>
                <html:hidden styleClass="checkbox" property="active" />
            </c:otherwise>
        </c:choose>
    </table>
    <div>
        <html:hidden property="id" />
        <html:hidden property="version" />
        <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.update" /></atleap:submit>
        <atleap:cancel styleClass="button"><atleap:message key="core.commons.buttons.cancel" /></atleap:cancel>
    </div>
</atleap:form>
